CURDIR = $(shell pwd)
DEPEND_LIBS=    libdrm                             \
                libavformat                        \
                libavcodec                         \
                libavutil                          \
                libswresample                      \
                libva-x11                          \
                libva-drm                          \
                libva


CFLAGS := $(shell pkg-config --cflags $(DEPEND_LIBS)) $(CFLAGS)
LDLIBS := $(shell pkg-config --libs $(DEPEND_LIBS)) $(LDLIBS)

CFLAGS += $(CFLAGS) -Wall -g
LDLIBS += $(LDLIBS) -lvdpau -lX11 -lpthread -ldl -lm -lOpenCL


DECODE=$(CURDIR)/../exec/videodecode

OBJS = hw_decode.o \
       vdpauinfo.o \
       device.o \
       va_display_x11.o \
       va_display_drm.o \
       va_display.o \
       vainfo.o \
       sw_decode.o \
       utils.o \
       hw_encode.o \
       main.o


.PHONY : all

all :  $(DECODE)

$(DECODE):$(OBJS)
	$(CC) -o $(DECODE) $(OBJS) $(LDLIBS)
	
$(warning  $(CFLAGS))

$(OBJS):%.o:%.c
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@
	

clean:
	rm -rf $(DECODE) $(OBJS)
